﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SQLiteHelp;


namespace TenyGlobalSite.admin
{
    public partial class contactusmanage : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetContact();
            }
        }

        private void GetContact()
        {
            ContactUs us = new ContactUs();
            ContactUsDAO dao = us.GetContactUSByID();
            if (dao != null)
            {
                this.editor1.Text = dao.Content;
                this.txtKeywords.Text = dao.MetaKeywords;
                this.txtDesc.Text = dao.MetaDesc;
            }
        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            ContactUs us = new ContactUs();
            us.ID = 1;
            us.Content = this.editor1.Text;
            us.MetaKeywords = this.txtKeywords.Text.Trim();
            us.MetaDesc = this.txtDesc.Text.Trim();
            int ret = us.UpdateContactUS();
            if (ret == 1)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "suc", "alert('更新成功');", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "suc", "alert('ERR:更新失败');", true);
            }
        }
    }
}